<script setup lang="ts">
import { onMounted } from 'vue'
import { Viewer,Cartesian3,Math } from 'cesium'

const {viewId= 'viewer'} = defineProps<{
  viewId?: string
}>()

onMounted(() => {
  const options: { [x: string]: boolean } = {
    geocoder: false, // 地理编码控件不显示
    homeButton: false, // 默认相机位置控件不显示
    sceneModePicker: false, // 场景模式控件不显示
    baseLayerPicker: false, // 基础图层控件不显示
    navigationHelpButton: false, // 导航帮助控件不显示
    animation: false, // 动画控件不显示
    timeline: false, // 时间线控件不显示
    fullscreenButton: false, // 全屏控件不显示
    vrButton: false, // vr控件不显示
    infoBox: false, // 信息框控件不显示，点击要素后不弹出信息栏
    selectionIndicator: false // 选择跟踪控件不显示，点击要素后不弹出锁定框
  }
  const viewer: Viewer = new Viewer(viewId,options)
  console.log('👉 ~ onMounted ~ viewer:', viewer)
  const Cartesian = Cartesian3.fromDegrees(119.56985, 34.20513, 10000)
  //相机
  viewer.camera.setView({
    destination: Cartesian,//初始位置
    orientation: {//初始方向
      heading: Math.toRadians(-50), //初始方向
      pitch: Math.toRadians(-50), //初始方向
      roll: Math.toRadians(0),
    }
  })
})
</script>
<template>
  <div :id="viewId" class="viewer-container">
 
  </div>
</template>

<style scoped>
@import url('./style.css');
</style>
